<?php

namespace App\Logics;

use App\Models\Admin;
use App\Models\SiteAdv;
use App\Models\SiteConfig;
use App\Models\SiteDomain;
use App\Models\SiteInfo;
use App\Models\SiteVersion;
use App\Service\Base\Logic;
use Illuminate\Support\Facades\Config;

class SiteLogic extends Logic
{

    // 首页广告
    public function adv()
    {
        $space = $this->option()->getData('space');
        $where = ['terminal' => 'app', 'status' => 1];
        $where = ['status' => 1];
        if($space){
            $where[] = ['space', '=', $space];
        }
        $list = (new SiteAdv())->isCache(true)->getList($where);

        return $list;
    }

    // 首页通知
    public function notice()
    {

    }

    // 站点配置信息
    public function config()
    {
        $lists  = (new SiteConfig())->isCache(true)->getConfig();
        $config = array_column($lists, 'value', 'field');

        return $config;
    }

    // 站点：帮助中心
    // 站点：联系我们
    // 站点：隐私协议
    // 站点：用户协议
    public function info($id)
    {
        $info = (new SiteInfo())->isCache(true)->oneFind(['id' => $id]);

        return $info;
    }

    // 版本号
    public function version($platform)
    {
        $info     = (new SiteVersion())->isCache(true)->oneFind(['platform' => $platform]);

        return $info;
    }

}


